| Total Complexity | 7 |
| Total Lines | 70 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import { |
||
| 20 | |||
| 21 | @Entity() |
||
| 22 | export class Quote { |
||
| 23 | @PrimaryGeneratedColumn('uuid') |
||
| 24 | private id: string; |
||
| 25 | |||
| 26 | @Column('enum', {enum: QuoteStatus, nullable: false}) |
||
| 27 | private status: QuoteStatus; |
||
| 28 | |||
| 29 | @Column({type: 'varchar', nullable: false, unique: true}) |
||
| 30 | private quoteId: string; |
||
| 31 | |||
| 32 | @Column({type: 'timestamp', default: () => 'CURRENT_TIMESTAMP'}) |
||
| 33 | private createdAt: Date; |
||
| 34 | |||
| 35 | @ManyToOne(type => User, {nullable: false}) |
||
| 36 | private owner: User; |
||
| 37 | |||
| 38 | @ManyToOne(type => Customer, {nullable: false}) |
||
| 39 | private customer: Customer; |
||
| 40 | |||
| 41 | @ManyToOne(type => Project, {nullable: true}) |
||
| 42 | private project: Project; |
||
| 43 | |||
| 44 | @OneToMany( |
||
| 45 | type => QuoteItem, |
||
| 46 | quoteItem => quoteItem.quote |
||
| 47 | ) |
||
| 48 | items: QuoteItem[]; |
||
| 49 | |||
| 50 | constructor( |
||
| 51 | quoteId: string, |
||
| 52 | status: QuoteStatus, |
||
| 53 | owner: User, |
||
| 54 | customer: Customer, |
||
| 55 | project?: Project | null |
||
| 56 | ) { |
||
| 57 | this.quoteId = quoteId; |
||
| 58 | this.status = status; |
||
| 59 | this.owner = owner; |
||
| 60 | this.customer = customer; |
||
| 61 | this.project = project; |
||
| 62 | } |
||
| 63 | |||
| 64 | public getId(): string { |
||
| 65 | return this.id; |
||
| 66 | } |
||
| 67 | |||
| 68 | public getQuoteId(): string { |
||
| 69 | return this.quoteId; |
||
| 70 | } |
||
| 71 | |||
| 72 | public getStatus(): QuoteStatus { |
||
| 73 | return this.status; |
||
| 74 | } |
||
| 75 | |||
| 76 | public getCreatedAt(): Date { |
||
| 77 | return this.createdAt; |
||
| 78 | } |
||
| 79 | |||
| 80 | public getCustomer(): Customer { |
||
| 81 | return this.customer; |
||
| 82 | } |
||
| 83 | |||
| 84 | public getProject(): Project | undefined { |
||
| 85 | return this.project; |
||
| 86 | } |
||
| 87 | |||
| 88 | public getItems(): QuoteItem[] { |
||
| 89 | return this.items; |
||
| 90 | } |
||
| 92 |